package com.ruoyi.web.controller.warning;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.warning.domain.entity.Storage;
import com.ruoyi.warning.service.IStorageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenhc
 * @since 2025-03-26
 */
@RestController
@RequestMapping("/storage")
@Api(tags = "存储", description = "用于处理存储相关操作的控制器")
public class StorageController {
    @Resource
    private IStorageService storageService;

    @ApiOperation("列表")
    //@PreAuthorize("@ss.hasPermi('system:config:export')")
    @GetMapping(value = "/list/{id}")
    public R list(@PathVariable String id)
    {
        LambdaQueryWrapper<Storage> wrapper = new LambdaQueryWrapper<Storage>()
                .eq(Storage::getDeviceId,id)
                .orderByDesc(Storage::getStoragePerc);
        return R.ok(storageService.list(wrapper));
    }
    
}
